{% extends "books/base.html" %}

{% block title %}
<title>books of publisher</title>
{% endblock %}

{% block body %}
<div id="page">
  {% if publisher %}
  <h2>books of publisher: {{ publisher }}</h2>
  {% else %}
  <h2>books of All Publishers </h2>
  {% endif %}
  <table class="tab1">
    <thead>
      <tr><th>id</th><th>book name</th><th>publication_date</th><th>author</th></tr>
    </thead>
    <tfoot>
      <tr><th>This is the foot of the table</th></tr>
    </tfoot>
    <tbody>
      {% for book in book_list %}
      <tr>
		<td>{{ book.id }}</td>
        <td><a href="{% url 'book:book_detail' book.id %}">{{ book.title }}</a></td>
        <td>{{ book.publication_date }}</td>
        <td><ul>
		  {% for author in book.authors.all %}
		  {#<a href="{% url 'book:author_detail' author.id %}"><li>{{ author }}</li></a>#}
		  <li>name: {{ author }}</li><li>sex: {{ author.get_sex_display }}</li>
		  {% endfor %}</ul></td>
      </tr>
      {% endfor %}
      <tr>
        <td><a href="{% url 'polls:index' %}">url(polls:index)</a></td>
        <td><a href="{% url 'polls:detail' pk=5 %}">url(polls:detail)</a></td>
        {# url(r'path/([\w-]+)/$' #}
        <td><a href="{% url 'book:publisher_book' '机械工业出版社' %}">url(book:publisher_book)</a></td>
        {# url(r'path/(?P<arg1>[\w-]+)/$' #}
        {% comment %}
        <td><a href="{% url 'book:publisher_book' arg1='机械工业出版社' %}">url(book:publisher_book)</a></td>
        {% endcomment %}
      </tr>
    </tbody>
  </table>
</div>
{% endblock %}
